from django.urls import re_path
from rest_framework.routers import DefaultRouter


from .views import labels, questions, reply

urlpatterns = [
    # """问答模块路由"""
    re_path('^labels/$', labels.LabelsView.as_view()),  # 所有标签列表
    re_path('^labels/users/$', labels.LabelsUsersView.as_view()),  # 用户关注的标签
    re_path('^labels/(?P<id>.+)/focusin/$', labels.LabelsIdFocusinView.as_view()),  # 关注标签
    re_path('^labels/(?P<id>.+)/focusout/$', labels.LabelsIdFocusoutView.as_view()),  # 取消关注标签
    re_path('^labels/(?P<pk>.+)/$', labels.LabelsIDView.as_view()),  # 标签详情
    re_path('^questions/(?P<id>.+)/label/new/$', questions.QuestionsIdLabelNewView.as_view()),  # 最新回答的问题
    re_path('^questions/(?P<id>.+)/label/hot/$', questions.QuestionsIdLabelHOTView.as_view()),  # 热门回答的问题
    re_path('^questions/(?P<id>.+)/label/wait/$', questions.QuestionsIdLabelWaitView.as_view()),  # 等待回答的问题
    re_path('^questions/(?P<id>.+)/useful/$', questions.QuestionsIdUsefulView.as_view()),  # 问题有用
    re_path('^questions/(?P<id>.+)/unuseful/$', questions.QuestionsIdUnusefulView.as_view()),  # 问题没用
    re_path('^reply/$', reply.ReplyView.as_view()),  # 回答问题
    re_path('^reply/(?P<id>.+)/useful/$', reply.ReplyIDUsefulView.as_view()),  # 回答有用
    re_path('^reply/(?P<id>.+)/unuseful/$', reply.ReplyIDUnusefulView.as_view()),  # 回答没用

]


router = DefaultRouter()

# 问题管理
router.register(r'questions', questions.QuestionsModelViewSet, basename='questions')
urlpatterns += router.urls

